from typing import Optional, List
from datetime import datetime
from decimal import Decimal
from pydantic import BaseModel
from .base import BaseSchema

class WorkAreaBase(BaseModel):
    Name: str
    EnglishName: str
    LicenseNo: str
    ManagerName: str
    ManagerUserNames: Optional[str] = None
    TelNo: str
    CityCode: str
    Address: Optional[str] = None
    ResellerRank: str
    Memo: Optional[str] = None
    Balance: Decimal = Decimal('0')
    # PDF相关字段
    PDFLogoUrl: Optional[str] = None
    PDFName: Optional[str] = None
    PDFAddress: Optional[str] = None
    PDFContactName: Optional[str] = None
    PDFTelNo: Optional[str] = None
    PDFEmail: Optional[str] = None
    PDFBankInfo: Optional[str] = None

class WorkAreaCreate(WorkAreaBase):
    pass

class WorkAreaUpdate(WorkAreaBase):
    Name: Optional[str] = None
    EnglishName: Optional[str] = None
    LicenseNo: Optional[str] = None
    ManagerName: Optional[str] = None
    ManagerUserNames: Optional[str] = None
    TelNo: Optional[str] = None
    CityCode: Optional[str] = None
    Address: Optional[str] = None
    ResellerRank: Optional[str] = None
    Memo: Optional[str] = None
    Balance: Optional[Decimal] = None
    PDFLogoUrl: Optional[str] = None
    PDFName: Optional[str] = None
    PDFAddress: Optional[str] = None
    PDFContactName: Optional[str] = None
    PDFTelNo: Optional[str] = None
    PDFEmail: Optional[str] = None
    PDFBankInfo: Optional[str] = None

class WorkArea(WorkAreaBase):
    ID: int
    
    class Config:
        from_attributes = True

class WorkAreaTransactionBase(BaseSchema):
    work_area_id: int
    transaction_type: str
    amount: float
    description: Optional[str] = None

class WorkAreaTransactionCreate(WorkAreaTransactionBase):
    pass

class WorkAreaTransactionUpdate(WorkAreaTransactionBase):
    pass

class WorkAreaTransaction(WorkAreaTransactionBase):
    ID: int
    CreateTime: datetime
    UpdateTime: Optional[datetime] = None 